package com.liu.shiro.controller;

import com.liu.shiro.entity.JsonData;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.subject.Subject;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

/**
 *  退出
 */
@RestController
public class LogoutController {

    @RequestMapping("/logout")
    public JsonData logout(){
        Subject subject = SecurityUtils.getSubject();
        if (subject.getPrincipal() != null ){

        }
       SecurityUtils.getSubject().logout();


        return JsonData.buildSuccess("退出成功！");
    }

}
